import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../components/forground/Home'
import Login from '../components/background/Login'
import Backstage from '../components/background/Backstage'

Vue.use(VueRouter)

const routes = [
    {
        path: '/',
        name: 'Home',
        component: Home
    },
    {
        path: '/login',
        name: 'Login',
        component: Login
    },
    {
        path: '/backstage',
        name: 'Backstage',
        component: Backstage,
        // 添加是否登录判断
        meta: {
            requireAuth: true
        }
    }
]

const router = new VueRouter({
    base: process.env.BASE_URL,
    routes
})

export default router
